# Dockerfile
# ---- Base Node ----
FROM node:lts-alpine AS base

ARG ENV_NAME

WORKDIR /app
COPY . .
RUN ls -a
# COPY .next/ ./.next/
# COPY node_modules ./node_modules
# COPY public ./public
# COPY package.json ./
# COPY next.config.js ./
# COPY next-i18next.config.js ./
# COPY middleware.js ./
COPY environments/$ENV_NAME ./.env.local
RUN echo .env=$ENV_NAME
RUN cat ./.env.local

# 啟用 Corepack 來管理 Yarn 版本
RUN corepack enable
RUN corepack prepare yarn@4.6.0 --activate

# 確保 Yarn 版本正確
RUN yarn -v  # (這會顯示 4.6.0)
RUN yarn install  
RUN yarn build

EXPOSE 3000
CMD [ "yarn", "start" ]
